#include <stdio.h>

int main() {
	int arr[5] = {0};
	int i = 0;
	int one_num = 0;
	int zero_num = 0;
	int mark = 0;
	
	for(i = 0; i < 5; i++)
	{
		scanf("%d",arr[i]);
		
		if(arr[i] == 0)
			zero_num++;
		else if(arr[i] == 1)
		{
			one_num++;
			mark = i+1;
		}
	}
	
	if(one_num == 1 && zero_num == 4)
	{
		printf("%d",mark);
	}
	else 
	{
		printf("error\n");
		return 1;
	}
	
	return 0;
}
